# Generated from AntlrHelloSyntax.g4 by ANTLR 4.9.2
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
	from typing import TextIO
else:
	from typing.io import TextIO


def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3!")
        buf.write("u\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b")
        buf.write("\t\b\4\t\t\t\4\n\t\n\3\2\6\2\26\n\2\r\2\16\2\27\3\3\3")
        buf.write("\3\3\3\5\3\35\n\3\3\3\3\3\3\4\3\4\3\4\3\4\5\4%\n\4\3\5")
        buf.write("\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\7\6\64")
        buf.write("\n\6\f\6\16\6\67\13\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7")
        buf.write("\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\5")
        buf.write("\7N\n\7\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\7\bY\n\b\f")
        buf.write("\b\16\b\\\13\b\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\7\t")
        buf.write("g\n\t\f\t\16\tj\13\t\3\n\3\n\3\n\3\n\3\n\3\n\3\n\5\ns")
        buf.write("\n\n\3\n\2\5\n\16\20\13\2\4\6\b\n\f\16\20\22\2\2\2}\2")
        buf.write("\25\3\2\2\2\4\34\3\2\2\2\6 \3\2\2\2\b&\3\2\2\2\n*\3\2")
        buf.write("\2\2\fM\3\2\2\2\16O\3\2\2\2\20]\3\2\2\2\22r\3\2\2\2\24")
        buf.write("\26\5\4\3\2\25\24\3\2\2\2\26\27\3\2\2\2\27\25\3\2\2\2")
        buf.write("\27\30\3\2\2\2\30\3\3\2\2\2\31\35\5\6\4\2\32\35\5\b\5")
        buf.write("\2\33\35\5\n\6\2\34\31\3\2\2\2\34\32\3\2\2\2\34\33\3\2")
        buf.write("\2\2\35\36\3\2\2\2\36\37\7\33\2\2\37\5\3\2\2\2 !\7\3\2")
        buf.write("\2!$\7\36\2\2\"#\7\37\2\2#%\5\n\6\2$\"\3\2\2\2$%\3\2\2")
        buf.write("\2%\7\3\2\2\2&\'\7\36\2\2\'(\7\37\2\2()\5\n\6\2)\t\3\2")
        buf.write("\2\2*+\b\6\1\2+,\5\f\7\2,\65\3\2\2\2-.\f\4\2\2./\7\16")
        buf.write("\2\2/\64\5\f\7\2\60\61\f\3\2\2\61\62\7\17\2\2\62\64\5")
        buf.write("\f\7\2\63-\3\2\2\2\63\60\3\2\2\2\64\67\3\2\2\2\65\63\3")
        buf.write("\2\2\2\65\66\3\2\2\2\66\13\3\2\2\2\67\65\3\2\2\28N\5\16")
        buf.write("\b\29:\5\16\b\2:;\7\26\2\2;<\5\16\b\2<N\3\2\2\2=>\5\16")
        buf.write("\b\2>?\7\27\2\2?@\5\16\b\2@N\3\2\2\2AB\5\16\b\2BC\7\30")
        buf.write("\2\2CD\5\16\b\2DN\3\2\2\2EF\5\16\b\2FG\7\31\2\2GH\5\16")
        buf.write("\b\2HN\3\2\2\2IJ\5\16\b\2JK\7\32\2\2KL\5\16\b\2LN\3\2")
        buf.write("\2\2M8\3\2\2\2M9\3\2\2\2M=\3\2\2\2MA\3\2\2\2ME\3\2\2\2")
        buf.write("MI\3\2\2\2N\r\3\2\2\2OP\b\b\1\2PQ\5\20\t\2QZ\3\2\2\2R")
        buf.write("S\f\4\2\2ST\7\22\2\2TY\5\20\t\2UV\f\3\2\2VW\7\23\2\2W")
        buf.write("Y\5\20\t\2XR\3\2\2\2XU\3\2\2\2Y\\\3\2\2\2ZX\3\2\2\2Z[")
        buf.write("\3\2\2\2[\17\3\2\2\2\\Z\3\2\2\2]^\b\t\1\2^_\5\22\n\2_")
        buf.write("h\3\2\2\2`a\f\4\2\2ab\7\24\2\2bg\5\22\n\2cd\f\3\2\2de")
        buf.write("\7\25\2\2eg\5\22\n\2f`\3\2\2\2fc\3\2\2\2gj\3\2\2\2hf\3")
        buf.write("\2\2\2hi\3\2\2\2i\21\3\2\2\2jh\3\2\2\2ks\7\36\2\2ls\7")
        buf.write("\20\2\2ms\7\21\2\2no\7\34\2\2op\5\n\6\2pq\7\35\2\2qs\3")
        buf.write("\2\2\2rk\3\2\2\2rl\3\2\2\2rm\3\2\2\2rn\3\2\2\2s\23\3\2")
        buf.write("\2\2\r\27\34$\63\65MXZfhr")
        return buf.getvalue()


class AntlrHelloSyntaxParser ( Parser ):

    grammarFileName = "AntlrHelloSyntax.g4"

    atn = ATNDeserializer().deserialize(serializedATN())

    decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'int'", "'string'", "'bool'", "'if'", 
                     "'else'", "'while'", "'for'", "'break'", "'continue'", 
                     "'true'", "'false'", "'and'", "'or'", "<INVALID>", 
                     "<INVALID>", "'+'", "'-'", "'*'", "'/'", "'>'", "'<'", 
                     "'=='", "'>='", "'<='", "';'", "'('", "')'", "<INVALID>", 
                     "'='" ]

    symbolicNames = [ "<INVALID>", "Int", "String", "Bool", "If", "Else", 
                      "While", "For", "Break", "Continue", "BTrue", "BFalse", 
                      "And", "Or", "IntLiteral", "StringLiteral", "Plus", 
                      "Minus", "Star", "Slash", "GT", "LT", "EQ", "GE", 
                      "LE", "Semicolon", "LeftParen", "RightParen", "Identifier", 
                      "Assignment", "WhiteSpace", "NewLine" ]

    RULE_program = 0
    RULE_expressionStmt = 1
    RULE_intDeclaration = 2
    RULE_assignmentExpression = 3
    RULE_boolExpression = 4
    RULE_comparision = 5
    RULE_additiveEx = 6
    RULE_multiplicativeEX = 7
    RULE_primary = 8

    ruleNames =  [ "program", "expressionStmt", "intDeclaration", "assignmentExpression", 
                   "boolExpression", "comparision", "additiveEx", "multiplicativeEX", 
                   "primary" ]

    EOF = Token.EOF
    Int=1
    String=2
    Bool=3
    If=4
    Else=5
    While=6
    For=7
    Break=8
    Continue=9
    BTrue=10
    BFalse=11
    And=12
    Or=13
    IntLiteral=14
    StringLiteral=15
    Plus=16
    Minus=17
    Star=18
    Slash=19
    GT=20
    LT=21
    EQ=22
    GE=23
    LE=24
    Semicolon=25
    LeftParen=26
    RightParen=27
    Identifier=28
    Assignment=29
    WhiteSpace=30
    NewLine=31

    def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.9.2")
        self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
        self._predicates = None




    class ProgramContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def expressionStmt(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AntlrHelloSyntaxParser.ExpressionStmtContext)
            else:
                return self.getTypedRuleContext(AntlrHelloSyntaxParser.ExpressionStmtContext,i)


        def getRuleIndex(self):
            return AntlrHelloSyntaxParser.RULE_program

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterProgram" ):
                listener.enterProgram(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitProgram" ):
                listener.exitProgram(self)




    def program(self):

        localctx = AntlrHelloSyntaxParser.ProgramContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_program)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 19 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 18
                self.expressionStmt()
                self.state = 21 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << AntlrHelloSyntaxParser.Int) | (1 << AntlrHelloSyntaxParser.IntLiteral) | (1 << AntlrHelloSyntaxParser.StringLiteral) | (1 << AntlrHelloSyntaxParser.LeftParen) | (1 << AntlrHelloSyntaxParser.Identifier))) != 0)):
                    break

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExpressionStmtContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def Semicolon(self):
            return self.getToken(AntlrHelloSyntaxParser.Semicolon, 0)

        def intDeclaration(self):
            return self.getTypedRuleContext(AntlrHelloSyntaxParser.IntDeclarationContext,0)


        def assignmentExpression(self):
            return self.getTypedRuleContext(AntlrHelloSyntaxParser.AssignmentExpressionContext,0)


        def boolExpression(self):
            return self.getTypedRuleContext(AntlrHelloSyntaxParser.BoolExpressionContext,0)


        def getRuleIndex(self):
            return AntlrHelloSyntaxParser.RULE_expressionStmt

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpressionStmt" ):
                listener.enterExpressionStmt(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpressionStmt" ):
                listener.exitExpressionStmt(self)




    def expressionStmt(self):

        localctx = AntlrHelloSyntaxParser.ExpressionStmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_expressionStmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 26
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,1,self._ctx)
            if la_ == 1:
                self.state = 23
                self.intDeclaration()
                pass

            elif la_ == 2:
                self.state = 24
                self.assignmentExpression()
                pass

            elif la_ == 3:
                self.state = 25
                self.boolExpression(0)
                pass


            self.state = 28
            self.match(AntlrHelloSyntaxParser.Semicolon)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IntDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def Int(self):
            return self.getToken(AntlrHelloSyntaxParser.Int, 0)

        def Identifier(self):
            return self.getToken(AntlrHelloSyntaxParser.Identifier, 0)

        def Assignment(self):
            return self.getToken(AntlrHelloSyntaxParser.Assignment, 0)

        def boolExpression(self):
            return self.getTypedRuleContext(AntlrHelloSyntaxParser.BoolExpressionContext,0)


        def getRuleIndex(self):
            return AntlrHelloSyntaxParser.RULE_intDeclaration

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterIntDeclaration" ):
                listener.enterIntDeclaration(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitIntDeclaration" ):
                listener.exitIntDeclaration(self)




    def intDeclaration(self):

        localctx = AntlrHelloSyntaxParser.IntDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_intDeclaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 30
            self.match(AntlrHelloSyntaxParser.Int)
            self.state = 31
            self.match(AntlrHelloSyntaxParser.Identifier)
            self.state = 34
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AntlrHelloSyntaxParser.Assignment:
                self.state = 32
                self.match(AntlrHelloSyntaxParser.Assignment)
                self.state = 33
                self.boolExpression(0)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AssignmentExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def Identifier(self):
            return self.getToken(AntlrHelloSyntaxParser.Identifier, 0)

        def Assignment(self):
            return self.getToken(AntlrHelloSyntaxParser.Assignment, 0)

        def boolExpression(self):
            return self.getTypedRuleContext(AntlrHelloSyntaxParser.BoolExpressionContext,0)


        def getRuleIndex(self):
            return AntlrHelloSyntaxParser.RULE_assignmentExpression

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAssignmentExpression" ):
                listener.enterAssignmentExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAssignmentExpression" ):
                listener.exitAssignmentExpression(self)




    def assignmentExpression(self):

        localctx = AntlrHelloSyntaxParser.AssignmentExpressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_assignmentExpression)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 36
            self.match(AntlrHelloSyntaxParser.Identifier)
            self.state = 37
            self.match(AntlrHelloSyntaxParser.Assignment)
            self.state = 38
            self.boolExpression(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BoolExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def comparision(self):
            return self.getTypedRuleContext(AntlrHelloSyntaxParser.ComparisionContext,0)


        def boolExpression(self):
            return self.getTypedRuleContext(AntlrHelloSyntaxParser.BoolExpressionContext,0)


        def And(self):
            return self.getToken(AntlrHelloSyntaxParser.And, 0)

        def Or(self):
            return self.getToken(AntlrHelloSyntaxParser.Or, 0)

        def getRuleIndex(self):
            return AntlrHelloSyntaxParser.RULE_boolExpression

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBoolExpression" ):
                listener.enterBoolExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBoolExpression" ):
                listener.exitBoolExpression(self)



    def boolExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = AntlrHelloSyntaxParser.BoolExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 8
        self.enterRecursionRule(localctx, 8, self.RULE_boolExpression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 41
            self.comparision()
            self._ctx.stop = self._input.LT(-1)
            self.state = 51
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,4,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 49
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,3,self._ctx)
                    if la_ == 1:
                        localctx = AntlrHelloSyntaxParser.BoolExpressionContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_boolExpression)
                        self.state = 43
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 44
                        self.match(AntlrHelloSyntaxParser.And)
                        self.state = 45
                        self.comparision()
                        pass

                    elif la_ == 2:
                        localctx = AntlrHelloSyntaxParser.BoolExpressionContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_boolExpression)
                        self.state = 46
                        if not self.precpred(self._ctx, 1):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                        self.state = 47
                        self.match(AntlrHelloSyntaxParser.Or)
                        self.state = 48
                        self.comparision()
                        pass

             
                self.state = 53
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,4,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.unrollRecursionContexts(_parentctx)
        return localctx


    class ComparisionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def additiveEx(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AntlrHelloSyntaxParser.AdditiveExContext)
            else:
                return self.getTypedRuleContext(AntlrHelloSyntaxParser.AdditiveExContext,i)


        def GT(self):
            return self.getToken(AntlrHelloSyntaxParser.GT, 0)

        def LT(self):
            return self.getToken(AntlrHelloSyntaxParser.LT, 0)

        def EQ(self):
            return self.getToken(AntlrHelloSyntaxParser.EQ, 0)

        def GE(self):
            return self.getToken(AntlrHelloSyntaxParser.GE, 0)

        def LE(self):
            return self.getToken(AntlrHelloSyntaxParser.LE, 0)

        def getRuleIndex(self):
            return AntlrHelloSyntaxParser.RULE_comparision

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterComparision" ):
                listener.enterComparision(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitComparision" ):
                listener.exitComparision(self)




    def comparision(self):

        localctx = AntlrHelloSyntaxParser.ComparisionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_comparision)
        try:
            self.state = 75
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,5,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 54
                self.additiveEx(0)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 55
                self.additiveEx(0)
                self.state = 56
                self.match(AntlrHelloSyntaxParser.GT)
                self.state = 57
                self.additiveEx(0)
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 59
                self.additiveEx(0)
                self.state = 60
                self.match(AntlrHelloSyntaxParser.LT)
                self.state = 61
                self.additiveEx(0)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 63
                self.additiveEx(0)
                self.state = 64
                self.match(AntlrHelloSyntaxParser.EQ)
                self.state = 65
                self.additiveEx(0)
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 67
                self.additiveEx(0)
                self.state = 68
                self.match(AntlrHelloSyntaxParser.GE)
                self.state = 69
                self.additiveEx(0)
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 71
                self.additiveEx(0)
                self.state = 72
                self.match(AntlrHelloSyntaxParser.LE)
                self.state = 73
                self.additiveEx(0)
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AdditiveExContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def multiplicativeEX(self):
            return self.getTypedRuleContext(AntlrHelloSyntaxParser.MultiplicativeEXContext,0)


        def additiveEx(self):
            return self.getTypedRuleContext(AntlrHelloSyntaxParser.AdditiveExContext,0)


        def Plus(self):
            return self.getToken(AntlrHelloSyntaxParser.Plus, 0)

        def Minus(self):
            return self.getToken(AntlrHelloSyntaxParser.Minus, 0)

        def getRuleIndex(self):
            return AntlrHelloSyntaxParser.RULE_additiveEx

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAdditiveEx" ):
                listener.enterAdditiveEx(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAdditiveEx" ):
                listener.exitAdditiveEx(self)



    def additiveEx(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = AntlrHelloSyntaxParser.AdditiveExContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 12
        self.enterRecursionRule(localctx, 12, self.RULE_additiveEx, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 78
            self.multiplicativeEX(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 88
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,7,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 86
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,6,self._ctx)
                    if la_ == 1:
                        localctx = AntlrHelloSyntaxParser.AdditiveExContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_additiveEx)
                        self.state = 80
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 81
                        self.match(AntlrHelloSyntaxParser.Plus)
                        self.state = 82
                        self.multiplicativeEX(0)
                        pass

                    elif la_ == 2:
                        localctx = AntlrHelloSyntaxParser.AdditiveExContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_additiveEx)
                        self.state = 83
                        if not self.precpred(self._ctx, 1):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                        self.state = 84
                        self.match(AntlrHelloSyntaxParser.Minus)
                        self.state = 85
                        self.multiplicativeEX(0)
                        pass

             
                self.state = 90
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,7,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.unrollRecursionContexts(_parentctx)
        return localctx


    class MultiplicativeEXContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def primary(self):
            return self.getTypedRuleContext(AntlrHelloSyntaxParser.PrimaryContext,0)


        def multiplicativeEX(self):
            return self.getTypedRuleContext(AntlrHelloSyntaxParser.MultiplicativeEXContext,0)


        def Star(self):
            return self.getToken(AntlrHelloSyntaxParser.Star, 0)

        def Slash(self):
            return self.getToken(AntlrHelloSyntaxParser.Slash, 0)

        def getRuleIndex(self):
            return AntlrHelloSyntaxParser.RULE_multiplicativeEX

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterMultiplicativeEX" ):
                listener.enterMultiplicativeEX(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitMultiplicativeEX" ):
                listener.exitMultiplicativeEX(self)



    def multiplicativeEX(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = AntlrHelloSyntaxParser.MultiplicativeEXContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 14
        self.enterRecursionRule(localctx, 14, self.RULE_multiplicativeEX, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 92
            self.primary()
            self._ctx.stop = self._input.LT(-1)
            self.state = 102
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,9,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 100
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,8,self._ctx)
                    if la_ == 1:
                        localctx = AntlrHelloSyntaxParser.MultiplicativeEXContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_multiplicativeEX)
                        self.state = 94
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 95
                        self.match(AntlrHelloSyntaxParser.Star)
                        self.state = 96
                        self.primary()
                        pass

                    elif la_ == 2:
                        localctx = AntlrHelloSyntaxParser.MultiplicativeEXContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_multiplicativeEX)
                        self.state = 97
                        if not self.precpred(self._ctx, 1):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                        self.state = 98
                        self.match(AntlrHelloSyntaxParser.Slash)
                        self.state = 99
                        self.primary()
                        pass

             
                self.state = 104
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,9,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.unrollRecursionContexts(_parentctx)
        return localctx


    class PrimaryContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def Identifier(self):
            return self.getToken(AntlrHelloSyntaxParser.Identifier, 0)

        def IntLiteral(self):
            return self.getToken(AntlrHelloSyntaxParser.IntLiteral, 0)

        def StringLiteral(self):
            return self.getToken(AntlrHelloSyntaxParser.StringLiteral, 0)

        def LeftParen(self):
            return self.getToken(AntlrHelloSyntaxParser.LeftParen, 0)

        def boolExpression(self):
            return self.getTypedRuleContext(AntlrHelloSyntaxParser.BoolExpressionContext,0)


        def RightParen(self):
            return self.getToken(AntlrHelloSyntaxParser.RightParen, 0)

        def getRuleIndex(self):
            return AntlrHelloSyntaxParser.RULE_primary

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimary" ):
                listener.enterPrimary(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimary" ):
                listener.exitPrimary(self)




    def primary(self):

        localctx = AntlrHelloSyntaxParser.PrimaryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_primary)
        try:
            self.state = 112
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [AntlrHelloSyntaxParser.Identifier]:
                self.enterOuterAlt(localctx, 1)
                self.state = 105
                self.match(AntlrHelloSyntaxParser.Identifier)
                pass
            elif token in [AntlrHelloSyntaxParser.IntLiteral]:
                self.enterOuterAlt(localctx, 2)
                self.state = 106
                self.match(AntlrHelloSyntaxParser.IntLiteral)
                pass
            elif token in [AntlrHelloSyntaxParser.StringLiteral]:
                self.enterOuterAlt(localctx, 3)
                self.state = 107
                self.match(AntlrHelloSyntaxParser.StringLiteral)
                pass
            elif token in [AntlrHelloSyntaxParser.LeftParen]:
                self.enterOuterAlt(localctx, 4)
                self.state = 108
                self.match(AntlrHelloSyntaxParser.LeftParen)
                self.state = 109
                self.boolExpression(0)
                self.state = 110
                self.match(AntlrHelloSyntaxParser.RightParen)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx



    def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int):
        if self._predicates == None:
            self._predicates = dict()
        self._predicates[4] = self.boolExpression_sempred
        self._predicates[6] = self.additiveEx_sempred
        self._predicates[7] = self.multiplicativeEX_sempred
        pred = self._predicates.get(ruleIndex, None)
        if pred is None:
            raise Exception("No predicate with index:" + str(ruleIndex))
        else:
            return pred(localctx, predIndex)

    def boolExpression_sempred(self, localctx:BoolExpressionContext, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 2)
         

            if predIndex == 1:
                return self.precpred(self._ctx, 1)
         

    def additiveEx_sempred(self, localctx:AdditiveExContext, predIndex:int):
            if predIndex == 2:
                return self.precpred(self._ctx, 2)
         

            if predIndex == 3:
                return self.precpred(self._ctx, 1)
         

    def multiplicativeEX_sempred(self, localctx:MultiplicativeEXContext, predIndex:int):
            if predIndex == 4:
                return self.precpred(self._ctx, 2)
         

            if predIndex == 5:
                return self.precpred(self._ctx, 1)
         




